import { routes } from '@/router/routes'
import { useAppStore } from '@/stores/app'
import { ref } from 'vue'

export default {
    onShareAppMessage(res: any): any {
        const appStore = useAppStore()
        const route = routes
        // console.log(route)
        // const that = this
        // const imageUrl = that.shareUrl || ''
        const curPageList: any = getCurrentPages()
        const curPage = curPageList[curPageList.length - 1].$page.fullPath
        if (res.from === 'button') {
            //这块需要传参，不然链接地址进去获取不到数据
            // const path = `/` + that.$scope.route + `?item=` + that.$scope.options.item
            return {
                title: appStore.getWebsiteConfig.name,
                path: curPage,
                imageUrl: ''
            }
        }
        if (res.from === 'menu') {
            return {
                title: appStore.getWebsiteConfig.name,
                path: curPage,
                imageUrl: ''
            }
        }
    },
    // 分享到朋友圈
    onShareTimeline() {
        const appStore = useAppStore()
        return {
            title: appStore.getWebsiteConfig.name,
            path: '/pages/index/index',
            imageUrl: ''
        }
    }
}
